#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
using namespace std;
FILE* fp;
unsigned long file_size;
unsigned char c;
unsigned int m_count[300], ccs = 0, dc = 0, jz = 0;//字符ccs，单词dc，句子jz
bool input_m(const char* path)
{
	if ((fp = fopen(path, "rb")) != NULL)
	{
		while ((c = fgetc(fp)) != EOF)
		{
			if (((c <= 'z') && (c >= 'a')) || ((c <= 'Z') && (c >= 'A')))
			{
				ccs++;
				dc++;
				while ((c = fgetc(fp)) != EOF)
				{
					if (((c <= 'z') && (c >= 'a')) || ((c <= 'Z') && (c >= 'A')))
					{
						ccs++;
					}
					else if (c == '\n')
					{
						jz++;
						break;
					}
					else if (c == ' ')
					{
						break;
					}
					else
					{
						break;
					}
				}
			}
			else if (c == ' ')
			{
				dc++;
			}
			else if (c == '\n')
			{
				jz++;
			}
			else
			{
				break;
			}
		}
		cout << "字符数为:" << ccs << endl;
		cout << "单词数为:" << dc << endl;
		cout << "句子数为:" << jz << endl;
		return 1;
	}
	else
	{
		cout << "open file error" << endl;
		return 0;
	}
}
int main()
{
	char path[100];  //c为输入命令 i为统计数量
	cout << "请输入：wc.exe -";
	cin >> path;
	input_m(path);
}
